package cn.iocoder.yudao.module.crossborder.order.dal.mysql.orderstatuslog;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.crossborder.order.dal.dataobject.orderstatuslog.OrderStatusLogDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.crossborder.order.controller.admin.orderstatuslog.vo.*;

/**
 * 跨境电商订单状态流转 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface OrderStatusLogMapper extends BaseMapperX<OrderStatusLogDO> {

    default PageResult<OrderStatusLogDO> selectPage(OrderStatusLogPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<OrderStatusLogDO>()
                .eqIfPresent(OrderStatusLogDO::getOrderId, reqVO.getOrderId())
                .eqIfPresent(OrderStatusLogDO::getOrderNo, reqVO.getOrderNo())
                .eqIfPresent(OrderStatusLogDO::getStatusType, reqVO.getStatusType())
                .eqIfPresent(OrderStatusLogDO::getOldStatus, reqVO.getOldStatus())
                .eqIfPresent(OrderStatusLogDO::getNewStatus, reqVO.getNewStatus())
                .likeIfPresent(OrderStatusLogDO::getOldStatusName, reqVO.getOldStatusName())
                .likeIfPresent(OrderStatusLogDO::getNewStatusName, reqVO.getNewStatusName())
                .eqIfPresent(OrderStatusLogDO::getChangeReason, reqVO.getChangeReason())
                .eqIfPresent(OrderStatusLogDO::getChangeSource, reqVO.getChangeSource())
                .eqIfPresent(OrderStatusLogDO::getOperatorId, reqVO.getOperatorId())
                .likeIfPresent(OrderStatusLogDO::getOperatorName, reqVO.getOperatorName())
                .eqIfPresent(OrderStatusLogDO::getOperatorType, reqVO.getOperatorType())
                .betweenIfPresent(OrderStatusLogDO::getChangeTime, reqVO.getChangeTime())
                .eqIfPresent(OrderStatusLogDO::getAdditionalData, reqVO.getAdditionalData())
                .eqIfPresent(OrderStatusLogDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(OrderStatusLogDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(OrderStatusLogDO::getId));
    }

}